<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <template id="t1">
      <div>
        <!-- 
          @事件名="回调函数"
         -->
        <button
          @click="()=>{ 
          let str = 'hello jack';
          log(str+age);
        }"
        >
          click
        </button>
        <!-- 回调函数结构可以省略不写  -->
        <button
          @click="
        let str = 'hello jack';
        log(str+age);"
        >
          click
        </button>
      </div>
    </template>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        template: "#t1",
        data: {
          age: 10,
        },
        methods: {
          log(data) {
            console.log(data);
          },
        },
      });
    </script>
  </body>
</html>
